package ru.pbem.olympia.core;

/**
 * User: Roman Pavlov
 * Date: 14-Sep-2010
 * Time: 15:53:05
 */
public class StringId implements Identity{
    private final String id;

    public StringId(final String id) {
        this.id = id;
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }

        final StringId stringId = (StringId) obj;

        return id.equals(stringId.getId());

    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    protected String getId() {
        return this.id;
    }

    @Override
    public String toString() {
        return "StringId{" +
                "id='" + id + '\'' +
                '}';
    }
}
